<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Bank extends Model
{
    protected $table = 'dd_bank';
    protected $primaryKey = 'id';
    public $timestamps = false;
    protected $guarded = array();
    
    /**
     * 添加新提现银行
     * @param \Illuminate\Http\Request $request
     * @return type
     */
    public static function addBank(\Illuminate\Http\Request $request) {
        $bank = $request->all();
        $res = static::firstOrCreate($bank);
        if ($res) {
            return \Illuminate\Support\Facades\Response::json([
                'status'    => 1,
                'info'      => '添加成功'
            ]);
        } else {
            return \Illuminate\Support\Facades\Response::json([
                'status'    => 0,
                'info'      => '添加失败'
            ]);
        }
    }
}
